//
//  LYYTopCollectionViewCell.m
//  Icar
//
//  Created by dllo on 15/10/21.
//  Copyright © 2015年 小龙侠. All rights reserved.
//

#import "LYYTopCollectionViewCell.h"
#import "StringWithHeight.h"
@implementation LYYTopCollectionViewCell

- (instancetype)initWithFrame:(CGRect)frame{
    
    self = [super initWithFrame:frame];
    if (self) {
        
        [self creatCell];
    }
    return self;
}

- (void)creatCell{
    
    self.label = [[UILabel alloc]initWithFrame:CGRectMake(WIDTH(8), HEIGHT(15), WIDTH(30), HEIGHT(15))];
    self.label.layer.borderWidth = 1;
    self.label.textAlignment = NSTextAlignmentCenter;
    self.label.layer.masksToBounds = YES;
    self.label.layer.borderColor = [BARCOLOR CGColor];
    self.label.textColor = BARCOLOR;
    [self.label setText:@"置顶"];
    [self.contentView addSubview:self.label];
    
    self.titleLabel = [[UILabel alloc]init];
    [self.contentView addSubview:self.titleLabel];
    self.titleLabel.numberOfLines = 2;
}

- (void)getTopModel:(LYYTopModel *)model{
    [self.titleLabel setText:model.title];
    if (SCREEN_HEIGHT == 736) {
        self.label.font = [UIFont systemFontOfSize:12.];
        self.titleLabel.font = [UIFont systemFontOfSize:16.];
       model.titleHeight = [StringWithHeight HeightWithText:self.titleLabel.text width:WIDTH(325) font:[UIFont systemFontOfSize:16.]];

    }else if (SCREEN_HEIGHT == 667){
        self.label.font = [UIFont systemFontOfSize:10.];
        self.titleLabel.font = [UIFont systemFontOfSize:14.];
        model.titleHeight = [StringWithHeight HeightWithText:self.titleLabel.text width:WIDTH(325) font:[UIFont systemFontOfSize:14.]];

    }else if (SCREEN_HEIGHT == 568){
        self.label.font = [UIFont systemFontOfSize:8.];
        self.titleLabel.font = [UIFont systemFontOfSize:12.];
        model.titleHeight = [StringWithHeight HeightWithText:self.titleLabel.text width:WIDTH(325) font:[UIFont systemFontOfSize:12.]];

    }else if (SCREEN_HEIGHT == 480){
        self.label.font = [UIFont systemFontOfSize:6.];
        self.titleLabel.font = [UIFont systemFontOfSize:10.];
        model.titleHeight = [StringWithHeight HeightWithText:self.titleLabel.text width:WIDTH(325) font:[UIFont systemFontOfSize:10.]];
    }
    [self.titleLabel setFrame:CGRectMake(WIDTH(45), HEIGHT(10), WIDTH(325),HEIGHT(model.titleHeight))];
    
}

@end
